package com.aitaoxue.palx.util;

import java.util.Date;
import java.util.TimeZone;

public class TimeZoneUtil {

	public static boolean isInEasternEightZone() {
		boolean defaultValue = true;

		if (TimeZone.getDefault() == TimeZone.getTimeZone("GMT+08")) {
			defaultValue = true;
		} else {
			defaultValue = false;
		}
		return defaultValue;
	}

	/**
	 * 根据不同时区,转换时间
	 */
	public static Date transformTime(Date date, TimeZone oldZone,
			TimeZone newZone) {
		Date finalDate = null;
		if (date != null) {
			int timeOffset = oldZone.getOffset(date.getTime())
					- newZone.getOffset(date.getTime());
			finalDate = new Date(date.getTime() - timeOffset);
		}
		return finalDate;
	}

}
